# -*- coding: utf-8 -*-
from scrapy.exceptions import DropItem
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
from utils import is_pku
class RenrenPipeline(object):
	def __init__(self):
		self.file = open('data.txt', 'wb')
	def process_item(self, item, spider):
		if is_pku(item['school']):
			#line = json.dumps(dict(item)) + "\n"		
			#self.file.write(line.decode('unicode_escape'))
			return item
		else:
			raise DropItem("Wrong school : %s" % item['school'])
